home *** CD-ROM | disk | FTP | other *** search
-
-
-
- rrrreeeeggggccccmmmmpppp((((3333GGGG)))) rrrreeeeggggccccmmmmpppp((((3333GGGG))))
-
-
-
- NNNNAAAAMMMMEEEE
- _rrrr_eeee_gggg_cccc_mmmm_pppp, _rrrr_eeee_gggg_eeee_xxxx - compile and execute regular expression
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_llll_iiii_bbbb_gggg_eeee_nnnn_...._hhhh_>>>>
-
- _cccc_cccc [_f_l_a_g ...] _f_i_l_e ... _----_llll_gggg_eeee_nnnn [_l_i_b_r_a_r_y ...]
-
- _cccc_hhhh_aaaa_rrrr _****_rrrr_eeee_gggg_cccc_mmmm_pppp _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_s_t_r_i_n_g_1 _[[[[_,,,, _cccc_hhhh_aaaa_rrrr _****_s_t_r_i_n_g_2_,,,, _...._...._...._]]]]_,,,,
- _((((_cccc_hhhh_aaaa_rrrr _****_))))_0000_))))_;;;;
-
- _cccc_hhhh_aaaa_rrrr _****_rrrr_eeee_gggg_eeee_xxxx _((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_r_e_,,,, _cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_s_u_b_j_e_c_t
- _[[[[_,,,, _cccc_hhhh_aaaa_rrrr _****_r_e_t_0_,,,, _...._...._...._]]]]_))))_;;;;
-
- _eeee_xxxx_tttt_eeee_rrrr_nnnn _cccc_hhhh_aaaa_rrrr _****___________llll_oooo_cccc_1111_;;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _rrrr_eeee_gggg_cccc_mmmm_pppp compiles a regular expression (consisting of the concatenated
- arguments) and returns a pointer to the compiled form. _mmmm_aaaa_llll_llll_oooo_cccc(3C) is
- used to create space for the compiled form. It is the user's
- responsibility to free unneeded space so allocated. A _NNNN_UUUU_LLLL_LLLL return from
- _rrrr_eeee_gggg_cccc_mmmm_pppp indicates an incorrect argument. _rrrr_eeee_gggg_cccc_mmmm_pppp(1) has been written to
- generally preclude the need for this routine at execution time.
-
- _rrrr_eeee_gggg_eeee_xxxx executes a compiled pattern against the subject string. Additional
- arguments are passed to receive values back. _rrrr_eeee_gggg_eeee_xxxx returns _NNNN_UUUU_LLLL_LLLL on
- failure or a pointer to the next unmatched character on success. A
- global character pointer ___________llll_oooo_cccc_1111 points to where the match began. Note
- that in the subject string the newline character (_\\\\_nnnn) is not considered a
- delimiter, thus constructs such as anchoring work only on the basis of
- the entire string, not any individual 'lines' within the string. _rrrr_eeee_gggg_cccc_mmmm_pppp
- and _rrrr_eeee_gggg_eeee_xxxx were mostly borrowed from the editor, _eeee_dddd(1); however, the
- syntax and semantics have been changed slightly. The following are the
- valid symbols and associated meanings.
-
- _[[[[_]]]]_****_...._^^^^ These symbols retain their meaning in _eeee_dddd(1).
-
- _$$$$ Matches the end of the string; _\\\\_nnnn matches a newline.
-
- _---- Within brackets the minus means _t_h_r_o_u_g_h. For example, _[[[[_aaaa_----_zzzz_]]]] is
- equivalent to _[[[[_aaaa_bbbb_cccc_dddd_...._...._...._xxxx_yyyy_zzzz_]]]]. The _---- can appear as itself only if
- used as the first or last character. For example, the
- character class expression _[[[[_]]]]_----_]]]] matches the characters _]]]] and _----.
-
- _++++ A regular expression followed by _++++ means _o_n_e _o_r _m_o_r_e _t_i_m_e_s.
- For example, _[[[[_0000_----_9999_]]]]_++++ is equivalent to _[[[[_0000_----_9999_]]]]_[[[[_0000_----_9999_]]]]_****_....
-
- _{{{{_m_}}}} _{{{{_m,_}}}} _{{{{_m,_u_}}}}
- Integer values enclosed in _{{{{_}}}} indicate the number of times the
- preceding regular expression is to be applied. The value _m is
- the minimum number and _u is a number, less than 256, which is
- the maximum. If only _m is present (that is, _{{{{_m_}}}}), it indicates
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- rrrreeeeggggccccmmmmpppp((((3333GGGG)))) rrrreeeeggggccccmmmmpppp((((3333GGGG))))
-
-
-
- the exact number of times the regular expression is to be
- applied. The value _{{{{_m_,,,,_}}}} is analogous to _{{{{_m,_i_n_f_i_n_i_t_y_}}}}_.... The
- plus (_++++) and star (_****) operations are equivalent to _{{{{_1111_,,,,_}}}} and
- _{{{{_0000_,,,,_}}}} respectively.
-
- _(((( _...._...._.... _))))_$$$$_n The value of the enclosed regular expression is to be returned.
- The value will be stored in the (_n+1)th argument following the
- subject argument. At most, ten enclosed regular expressions
- are allowed. _rrrr_eeee_gggg_eeee_xxxx makes its assignments unconditionally.
-
- _(((( _...._...._.... _)))) Parentheses are used for grouping. An operator, for example,
- _****, _++++, _{{{{_}}}}, can work on a single character or a regular
- expression enclosed in parentheses. For example, _((((_aaaa_****_((((_cccc_bbbb_++++_))))_****_))))_$$$$_0000.
-
- By necessity, all the above defined symbols are special. They must,
- therefore, be escaped with a _\\\\ (backslash) to be used as themselves. In
- some cases (parenthesis _((((_)))) and braces _{{{{_}}}}) this is exactly the opposite of
- _eeee_dddd(1).
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- The following example matches a leading newline in the subject string
- pointed at by cursor.
-
- _cccc_hhhh_aaaa_rrrr _****_cccc_uuuu_rrrr_ssss_oooo_rrrr_,,,, _****_nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr_,,,, _****_pppp_tttt_rrrr_;;;;
- _...._...._....
- _nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr _==== _rrrr_eeee_gggg_eeee_xxxx_((((_((((_pppp_tttt_rrrr _==== _((((_cccc_hhhh_aaaa_rrrr _****_))))_rrrr_eeee_gggg_cccc_mmmm_pppp_((((_""""_^^^^_\\\\_nnnn_""""_,,,, _((((_cccc_hhhh_aaaa_rrrr _****_))))_0000_))))_))))_,,,, _cccc_uuuu_rrrr_ssss_oooo_rrrr_))))_;;;;
- _ffff_rrrr_eeee_eeee_((((_pppp_tttt_rrrr_))))_;;;;
-
- The following example matches through the string _TTTT_eeee_ssss_tttt_iiii_nnnn_gggg_3333 and returns the
- address of the character after the last matched character (the ``_4444'').
- The string _TTTT_eeee_ssss_tttt_iiii_nnnn_gggg_3333 is copied to the character array _rrrr_eeee_tttt_0000.
-
- _cccc_hhhh_aaaa_rrrr _rrrr_eeee_tttt_0000_[[[[_9999_]]]]_;;;;
- _cccc_hhhh_aaaa_rrrr _****_nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr_,,,, _****_nnnn_aaaa_mmmm_eeee_;;;;
- _...._...._....
- _nnnn_aaaa_mmmm_eeee _==== _rrrr_eeee_gggg_cccc_mmmm_pppp_((((_""""_((((_[[[[_AAAA_----_ZZZZ_aaaa_----_zzzz_]]]]_[[[[_AAAA_----_zzzz_aaaa_----_zzzz_0000_----_9999_]]]]_{{{{_0000_,,,,_7777_}}}}_))))_$$$$_0000_""""_,,,, _((((_cccc_hhhh_aaaa_rrrr _****_))))_0000_))))_;;;;
- _nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr _==== _rrrr_eeee_gggg_eeee_xxxx_((((_nnnn_aaaa_mmmm_eeee_,,,, _""""_0000_1111_2222_TTTT_eeee_ssss_tttt_iiii_nnnn_gggg_3333_4444_5555_""""_,,,, _rrrr_eeee_tttt_0000_))))_;;;;
-
- The following example applies a precompiled regular expression in _ffff_iiii_llll_eeee_...._iiii
- [see _rrrr_eeee_gggg_cccc_mmmm_pppp(1)] against _s_t_r_i_n_g.
-
- _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _""""_ffff_iiii_llll_eeee_...._iiii_""""
- _cccc_hhhh_aaaa_rrrr _****_ssss_tttt_rrrr_iiii_nnnn_gggg_,,,, _****_nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr_;;;;
- _...._...._....
- _nnnn_eeee_wwww_cccc_uuuu_rrrr_ssss_oooo_rrrr _==== _rrrr_eeee_gggg_eeee_xxxx_((((_nnnn_aaaa_mmmm_eeee_,,,, _ssss_tttt_rrrr_iiii_nnnn_gggg_))))_;;;;
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- _eeee_dddd(1), _rrrr_eeee_gggg_cccc_mmmm_pppp(1), _mmmm_aaaa_llll_llll_oooo_cccc(3C)
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- rrrreeeeggggccccmmmmpppp((((3333GGGG)))) rrrreeeeggggccccmmmmpppp((((3333GGGG))))
-
-
-
- NOTES
- The user program may run out of memory if _rrrr_eeee_gggg_cccc_mmmm_pppp is called iteratively
- without freeing the vectors no longer required.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-